Skip to content

Fix(redshift): add missing db_user parameter for IAM auth#5687

Open
synthpieter wants to merge 5 commits into
SQLMesh:mainfrom
synthpieter:fix/redshift-iam-db-user
Open

Fix(redshift): add missing db_user parameter for IAM auth#5687
synthpieter wants to merge 5 commits into
SQLMesh:mainfrom
synthpieter:fix/redshift-iam-db-user

Conversation

@synthpieter

@synthpieter synthpieter commented Feb 2, 2026

Copy link
Copy Markdown

Problem

SQLMesh's Redshift connection configuration was missing the db_user parameter, which is required by the redshift_connector library when using IAM authentication.

When enabling iam (iam: True) in the connection config it throws, understandably so, an InterfaceError

redshift_connector.error.InterfaceError: Connection parameter db_user must be specified when using IAM authentication

However, it was not allowed to add this parameter to the config.

Error: Invalid 'redshift' connection config:
  Invalid field 'db_user':
    Extra inputs are not permitted

Verify your config.yaml and environment variables.

So iam authentication was not really useable.

Solution

Added the db_user field to the RedshiftConnectionConfig class in three places:

  1. Documentation - Added parameter description in the docstring and docs
  2. Field Declaration - Added db_user: t.Optional[str] = None to the class
  3. Connection Kwargs - Added "db_user" to the _connection_kwargs_keys property
  4. Tests - Added db_user to corresponding test.

Usage

With this fix, you can now configure Redshift IAM authentication in config.yaml:

gateways:
  redshift:
    connection:
      type: redshift
      database: your_database
      host: your-cluster.region.redshift.amazonaws.com
      port: 5439
      cluster_identifier: your-cluster
      iam: True
      db_user: your_db_username

Fixes #2146

Disclaimer

This is my first contribution to an open source project ever, so please let me know if this is the right way of doing things :)
I locally give the fix a spin and it seems to fix the problem!

@CLAassistant

CLAassistant commented Feb 2, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@synthpieter synthpieter force-pushed the fix/redshift-iam-db-user branch from 5c38736 to f20bb1b Compare February 2, 2026 11:01
@StuffbyYuki

Copy link
Copy Markdown
Collaborator

@synthpieter it looks like there is some conflict with the base branch. Would you mind looking into revolving that?

@synthpieter

Copy link
Copy Markdown
Author

@StuffbyYuki I just fixed the conflict! To be honest there was something going on with a test in the pipeline before and tried to fix that, but honestly couldn't make it work at the time. That looks gone though!

@StuffbyYuki

Copy link
Copy Markdown
Collaborator

@synthpieter k it looks like your commits need DCO checks. Could you add them?

"All proposed commits should include a Signed-off-by: line in their commit message. This is most conveniently done by using --signoff (-s) when running git commit."

@StuffbyYuki

Copy link
Copy Markdown
Collaborator

Once everything looks good I'll merge this PR!

@StuffbyYuki

Copy link
Copy Markdown
Collaborator

@synthpieter Just following up on my last comment!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support IAM profile authentication for Redshift

3 participants